{include file="layout/layout" /}
<script type="text/javascript" charset="utf-8" src="__ROOT__public/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__public/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__ROOT__public/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/js/laydate/dist/laydate.js"></script>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>申请 - 广告信息</h3>
                <h5>代理申请</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="user_form" enctype="multipart/form-data" action="{:url('index/ads/add_act')}" method="post">
        <input type="hidden" name="ad_mart" value="{$ad_mart}">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>申请广告位置</label>
                </dt>
                <dd class="opt">
                    <input value="1" name="ad_label" id="gender1"  type="radio">
                    <label for="gender1">头部Bnner</label>
                    <input value="3" name="ad_label" id="gender3" type="radio" checked>
                    <label for="gender3">底部Foot</label>
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>广告描述</label>
                </dt>
                <dd class="opt">
                    <input class="span12 ckeditor"  name="ad_desc" id="describe">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>上传广告图</label>
                </dt>
                <dd class="opt"><strong class="red">点我&nbsp;&nbsp;&nbsp;<input type='file' name='ad_image_url' id="role_desc"></strong>
                    <p class="notic"></p>
                    <p class="notic">1.头部banner尺寸:750*300px； 2.底部foot尺寸：750*148px</p>
                </dd>

            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>开始时间</label>
                </dt>
                <dd class="opt"><input type="text" name="ad_start_time" id="start_time"></dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>结束时间</label>
                </dt>
                <dd class="opt"><input type="text" name="ad_end_time" id="end_time"></dd>
            </dl>

            <div class="bot"><button id="button" style="width:96px;height:35px;background: #4FC0E8;border-radius:5px;line-height:35px;text-align: center;color:#fff;border: 0;font-size: 15px;">确认提交</button></div>
        </div>
    </form>
</div>
<script type="text/javascript">
     $('#mobile').blur(function(){
            var v = $(this).val();
             if(!(/^1[34578]\d{9}$/.test(v))){
                $(this).next().next().html("<font color='red'>不合法</font>");
                $('#button').attr("disabled",true);
            }else{
                $(this).next().next().html("<font color='green'>正确</font>");
                $('#button').attr("disabled",false);
            }
        })
</script>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });
        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });

        getDate('#start_time');
        getDate('#end_time');
    });
    //指定id将表单改为时间格式
    function getDate(id){
        var objid = id;
        laydate.render({
            elem: objid,
            type: 'datetime',
        });
    }
    function layDate(){
        var id=$(this).attr("id");
        laydate.skin('molv');//选择肤色
        laydate({
            elem: '#'+id,
            format: 'YYYY-MM-DD hh:mm:ss', // 分隔符可以任意定义，该例子表示只显示年月
            istime: true, //是否开启时间选择
            isclear: true, //是否显示清空
            istoday: true, //是否显示今天
            issure: true, //是否显示确认
            festival: true, //显示节日
            min: '1970-01-01 00:00:00', //最小日期
            max: '2099-12-31 23:59:59', //最大日期
            start: laydate.now(0),//开始日期
            fixed: false, //是否固定在可视区域
            zIndex: 99999999, //css z-index
            choose: function(dates){ //选择好日期的回调
            }
        });
    }

</script>
<script>
    $('#button').click(function check_form(){
        var start_time = $.trim($('#start_time').val());
        var end_time =  $.trim($('#end_time').val());
        var describe =  $.trim($('#describe').val());
        var role_desc =  $.trim($('#role_desc').val());

        if(describe==''){
            layer.alert('描述不能为空', {icon: 2});
            return false;
        }
        if(start_time == '' ^ end_time == ''){
            layer.alert('请选择完整的时间间隔', {icon: 2});
            return false;
        }
        if(start_time == '' || end_time == ''){
            layer.alert('请选择时间', {icon: 2});
            return false;
        }

        if(role_desc==''){
            layer.alert('请选择上传图片', {icon: 2});
            return false;
        }

        return true;
    });

</script>

</body></html>